<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/


// Route::get('/', function () {
//     return view('welcome');
// });

//验证码路由
Route::get('/code','CodeController@index');
//后台登录路由
Route::get('/admin','Admin\LoginController@index');
//处理后台登录
Route::post('/admin/login','Admin\LoginController@do_login');
//后台标签二级分类
    Route::get('/admin/tag/fenlei','Admin\TagController@fenlei');
//后台路由组
Route::group(['prefix'=>'admin','namespace'=>'Admin','middleware'=>['login']],function(){
    //后台主页
    Route::get('index','IndexController@index');
    //退出登录
    Route::get('logout','IndexController@logout');
    //修改密码
    Route::get('pass','IndexController@pass');
    Route::post('pass','IndexController@dopass');
    //处理上传头像
    Route::post('upload','AdminUserController@upload');
    //管理员管理
    Route::resource('adminuser','AdminUserController');
    Route::get('admin_name','AdminUserController@admin_name');
    Route::get('admin_email','AdminUserController@admin_email');
    //网站配置路由
    Route::resource('config','ConfigController');
    //网站配置logo
    Route::post('uploads','ConfigController@uploads');
    //网站修改logo
    Route::post('config/edit/{id}','ConfigController@config');
    // 后台友情链接
    Route::resource('link','LinkController');
    // 后台分类管理
    Route::get('category/add/{id}','CategoryController@add');
    Route::resource('category','CategoryController');

    // 后台标签管理
    Route::resource('tag','TagController');
    //后台标签二级分类
    Route::get('/admin/tag/fenlei','Admin\TagController@fenlei');
    //后台问题管理路由
    Route::resource('question','QuestionController');
    //后台问题回收站
    Route::get('question/delete/{id}','QuestionController@delete');
    //展示回收站
    Route::get('question/do_delete/{id}','QuestionController@do_delete');
    //还原回收站的问题
    Route::get('question/do_history/{id}','QuestionController@do_history');


    //后台回复管理路由
    Route::resource('answer','AnswerController');
    //展示回复回收站
    Route::get('history','AnswerController@history');
    //还原回收站的回复
    Route::get('answer/do_history/{id}','AnswerController@do_history');

    //角色路由
    Route::resource('role','RoleController');
    Route::post('role/auth','RoleController@auth');
    //权限路由
    Route::resource('permission','PermissionController');
    Route::post('adminuser/auth','AdminUserController@auth');


    //后台轮播路由管理
    Route::resource('carousel','CarouselController');
    //后台轮播上传路由
    Route::post('carousel/upload','CarouselController@upload');
    //后台轮播修改logo
    Route::post('carousel/edit/{id}','CarouselController@do_delete');
    //后台轮播放入回收站
    Route::get('carousel/do_history/{id}','CarouselController@do_history');
    //后台轮播还原
    Route::get('carousel/delete/{id}','CarouselController@delete');
    //后台轮播删除
    Route::get('carousel/delete_lunbo/{id}','CarouselController@delete_lunbo');

    // 后台 公告模块
    Route::resource('placard','PlacardController');

    //前台(后台)用户
    Route::resource('homeuser','HomeuserController');

    //前台(后台)用户详情
    Route::resource('homedetails','HomedetailsController');

    // 后台 用户反馈及建议
    Route::resource('suggest','SuggestController');
});

//-------------------home--------------------------------------------
//获取手机验证码
Route::get('/phoneCode','Home\RegisterController@phoneCode');
Route::post('/home/register/insert','Home\RegisterController@insert');

//前台登录
Route::get('/home','Home\LoginController@index');
//处理前台登录
Route::post('/home','Home\LoginController@do_login');
//处理前台注册
Route::post('/home/register','Home\RegisterController@index');

//ajax验证开始
Route::get('/yzuser','Home\RegisterController@yzuser');
Route::get('/yzphone','Home\RegisterController@yzphone');
Route::get('/dluser','Home\LoginController@dluser');
Route::get('/dlpass','Home\LoginController@dlpass');
//ajax结束

//加载前台主页面
Route::resource('/','Home\IndexController');

//处理前台退出登录
Route::get('/home/logout','Home\IndexController@logout');
//处理前台搜索
Route::get('/home/search','Home\CommonController@search');

//前台问题列表页
Route::get('/home/list','Home\QuestionController@list');
//前台问题二级分类
Route::get('/home/question/create','Home\QuestionController@create');
Route::get('/home/tag_name','Home\QuestionController@tag_name');
//前台回复路由
Route::resource('/home/answer','Home\AnswerController');
//前台回复的父级id为零的
Route::get('/home/answer/fuji','Home\AnswerController@getCommlist');
//前台盖楼ajax
Route::get('/home/show_detail','Home\AnswerController@show_detail');

//追加评论
Route::resource('/home/reply','Home\ReplyController');
// Route::get('/{id}','Home\IndexController@show');

//前台标签分类
Route::get('/home/tag_name','Home\QuestionController@tag_name');

//前台轮播列表页
Route::resource('/home/carousellist','Home\CarouselListController');

// 前台公告内容显示
Route::get('/{id}','Home\IndexController@showPlacard');
//前台个人中心验证码路由
Route::get('/code/captcha/{tmp}', 'Home\UsersettingsController@captcha');

//前台忘记密码展示页
Route::get('/home/forget_pass','Home\LoginController@forget_pass');
//前台ajax验证用户邮箱是否存在
Route::get('/home/ajax_pass','Home\LoginController@ajax_pass');
//邮箱的验证
Route::post('/home/do_email','Home\LoginController@do_email');
//加载重置密码页面
Route::get('/home/restart_pass','Home\LoginController@restart_pass');
//执行密码的重新修改
Route::post('/home/do_restart_pass','Home\LoginController@do_restart_pass');


// 前台路由组判断是否登录
Route::group(['middleware'=>['Homelogin']],function(){

        //处理前台退出登录
        Route::get('/home/logout','Home\IndexController@logout');

        //前台回复路由
        Route::resource('home/answer','Home\AnswerController');
        //前台问题路由展示
        Route::resource('/home/question','Home\QuestionController');
        //前台处理提交回答
        Route::post('/home/answer','Home\AnswerController@store');
        //前台个人中心--我的问题
        Route::get('/home/user/question','Home\UserController@question');

        //前台个人中心--我的回答
        Route::get('/home/user/answer','Home\UserController@answer');

        //前台个人中心--成长与徽章
        Route::get('/home/user/grow','Home\UserController@grow');

        //前台个人中心--修改设置
        Route::get('/home/user/modify','Home\UserController@modify');

        //前台个人中心--账号设置
        Route::get('/home/usersettings/index','Home\UsersettingsController@index');

        //前台个人中心--基本设置
        Route::get('/home/usersettings/edit','Home\UsersettingsController@edit');
        Route::post('/home/usersettings/doedit','Home\UsersettingsController@doedit');

        //前台个人中心--头像设置
        Route::get('/home/usersettings/photos','Home\UsersettingsController@photos');
        Route::post('/home/usersettings/dophotos','Home\UsersettingsController@dophotos');

        //前台个人中心--头像设置
        Route::get('/home/usersettings/photos','Home\UsersettingsController@photos');
        Route::post('/home/usersettings/dophotos','Home\UsersettingsController@dophotos');
        //前台个人中心--账户安全
        Route::get('/home/usersettings/security','Home\UsersettingsController@security');
        //修改密码
        Route::get('/home/usersecurity/userpass','Home\UsersettingsController@userpass');

        Route::post('/home/usersecurity/passedit','Home\UsersettingsController@passedit');

        Route::post('/home/usersecurity/passcomplete','Home\UsersettingsController@passcomplete');

        //修改手机
        Route::get('/home/usersecurity/userphone','Home\UsersettingsController@userphone');

        Route::post('/home/do_phone_edit','Home\UsersettingsController@do_phone_edit');

        Route::post('/home/usersecurity/phonecomplete','Home\UsersettingsController@phonecomplete');

        //修改邮箱
        Route::get('/home/usersecurity/useremail','Home\UsersettingsController@useremail');

        Route::post('/home/usersecurity/emailedit','Home\UsersettingsController@emailedit');


        Route::post('/home/usersecurity/emailcomplete','Home\UsersettingsController@emailcomplete');

});
 // 前台 用户反馈及建议
Route::resource('/home/suggest','Home\SuggestController');
// 前台 用户反馈图片
Route::post('/home/upload','Home\SuggestController@upload');

// Route::get('/{id}','Home\IndexController@show');

// 前台公告内容显示
Route::get('/{id}','Home\IndexController@showPlacard');
// 前台用户中心.排行
Route::get('/home/userdetail/{id}','Home\IndexController@showDetail');

Route::post('/home/usersettings/dophotos','Home\UsersettingsController@dophotos');


Route::post('/home/usersettings/doedit','Home\UsersettingsController@doedit');



















